﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HomeStayWebCP.Models;
using HomeStayWebCP.Utility;
using HomeStayWebCP.Models.BusinessObject;
using DAL;

namespace HomeStayWebCP.Controllers
{
    public class NewsController : Controller
    {
        NewModel model = new NewModel();

        public ActionResult News()
        {
            
            List<NewsItem> listNews =  model.GetAllNew();
            ViewBag.listNews = listNews;
            return View();
        }
        public ActionResult CreateNew()
        {
            return View();
        }
        public ActionResult ReadNew(int newID)
        {
            News news = model.GetNewDetails(newID);
            if (news != null)
            {
                ViewBag.NewDetails = news;
            }            
            return View();
        }
    }
}
